﻿namespace Mars.DeviceProfiles
{
    public class DeviceProfileManager
    {
        private static DeviceProfileManager instance;
        private static IDeviceProfileSelector deviceProfileSelector;

        private DeviceProfileManager()
        {

        }

        public static DeviceProfileManager Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new DeviceProfileManager();
#if UNITY_IOS
                deviceProfileSelector = new IOSDeviceProfileSelector();
#else
                    deviceProfileSelector = new AndroidDeviceProfileSelector();
#endif
                    instance.InitData();
                }

                return instance;
            }
        }

        // 获取配置文件名 可以根据这个细化到某一个类型的设备
        public string FindMatchingProfile()
        {
            return deviceProfileSelector.FindMatchingProfile();
        }

        // 获取当前设备等级
        public ETCQualityGrade GetDeviceGrade()
        {
            return deviceProfileSelector.GetDeviceGrade();
        }

        // 是否在黑名单里面
        public bool IsInBlackList()
        {
            return deviceProfileSelector.IsInBlackList();
        }

        private void InitData()
        {
            deviceProfileSelector.InitData();
        }

        public string GetGPUFamily()
        {
            return deviceProfileSelector.GetGPUFamily();
        }

        public string GetGLVersion()
        {
            return deviceProfileSelector.GetGLVersion();
        }

        public string GetDeviceModel()
        {
            return deviceProfileSelector.GetDeviceModel();
        }

        public string GetDeviceMake()
        {
            return deviceProfileSelector.GetDeviceMake();
        }

        public string GetOSVersion()
        {
            return deviceProfileSelector.GetOSVersion();
        }

        public string GetMemorySizeInGB()
        {
            return deviceProfileSelector.GetMemorySizeInGB();
        }

        public string GetCPUNumCores()
        {
            return deviceProfileSelector.GetCPUNumCores();
        }

        public string GetCPUMaxFreq()
        {
            return deviceProfileSelector.GetCPUMaxFreq();
        }

        public int GetScore()
        {
            return deviceProfileSelector.GetScore();
        }
    }
}